home *** CD-ROM | disk | FTP | other *** search
- // eHelpÆ Corporation
- // Copyright© 1998-2000 eHelpÆ Corporation.All rights reserved.
- // ShowWebHelp.js
- // This is a Helper js file for WebHelp Content Sensitive Help.
- // Contents used as the Options for widnow.open.
- // Now Only support for IE4 and above and NS4.
-
- var WOF_LOCATION = 0x1;
- var WOF_MENUBAR = 0x2;
- var WOF_RESIZABLE = 0x4;
- var WOF_TOOLBAR = 0x8;
- var WOF_STATUS = 0x10;
- var WOF_SCROLLBARS = 0x20;
-
-
- // the parameter user can set from their own JavaScript.
- var gbWindowOption = WOF_SCROLLBARS | WOF_RESIZABLE;
- var gbWindowPosLeft = 0;
- var gbWindowPosTop = 0;
- var gbWindowPosWidth = 400;
- var gbWindowPosHeight = 400;
-
- // the Helper function will invoke the Webhelp Content Sensitive Help
- // here strUrl should be the <relative Path>/**_csh.htm#parameter
- // or you can specify the abs path. or URL.
- // user also can pass window option through strURL.
-
- var swh_strAgent = navigator.userAgent.toLowerCase();
-
- var swh_IE = (swh_strAgent.indexOf("msie") != -1);
-
- function ShowWebHelp(strUrl)
- {
- var strHelpOptions = "";
-
- var nUserOptionPos = strUrl.indexOf(",");
- var strUsrWindowOption = "";
-
- if (nUserOptionPos != -1) {
- strUsrWindowOption = strUrl.substring(nUserOptionPos+1);
- strUrl = strUrl.substring(0, nUserOptionPos);
- }
- if (strUsrWindowOption.indexOf("location=") == -1) {
- if (gbWindowOption & WOF_LOCATION) // Show/Hide Address bar {yes | no}
- strHelpOptions += ",location=yes";
- else
- strHelpOptions += ",location=no";
- }
-
- if (strUsrWindowOption.indexOf("toolbar=") == -1) {
- if (gbWindowOption & WOF_TOOLBAR) // Show/Hide Toolbar {yes | no}
- strHelpOptions += ",toolbar=yes";
- else
- strHelpOptions += ",toolbar=no";
- }
-
- if (strUsrWindowOption.indexOf("menubar=") == -1) {
- if (gbWindowOption & WOF_MENUBAR) // Show/Hide Menubar {yes | no}
- strHelpOptions += ",menubar=yes";
- else
- strHelpOptions += ",menubar=no";
- }
-
- if (strUsrWindowOption.indexOf("status=") == -1) {
- if (gbWindowOption & WOF_STATUS) // Show/Hide Statusbar {yes | no}
- strHelpOptions += ",status=yes";
- else
- strHelpOptions += ",status=no";
- }
-
- if (strUsrWindowOption.indexOf("scrollbars=") == -1) {
- if (gbWindowOption & WOF_SCROLLBARS) // Show/Hide Scrollbar {yes | no}
- strHelpOptions += ",scrollbars=yes";
- else
- strHelpOptions += ",scrollbars=no";
- }
-
- if (strUsrWindowOption.indexOf("resizable=") == -1) {
- if (gbWindowOption & WOF_RESIZABLE) // Allow help window resizing {yes | no}
- strHelpOptions += ",resizable=yes";
- else
- strHelpOptions += ",resizable=no";
- }
-
- if (strUsrWindowOption.indexOf("top=") == -1)
- strHelpOptions += ",top=" + gbWindowPosTop; // Top position for help window (in pixels)
-
- if (strUsrWindowOption.indexOf("screenY=") == -1)
- strHelpOptions += ",screenY=" + gbWindowPosTop; // Top position for help window (in pixels)(for netscape)
-
- if (strUsrWindowOption.indexOf("left=") == -1)
- strHelpOptions += ",left=" + gbWindowPosLeft; // Left position for help window (in pixels)
-
- if (strUsrWindowOption.indexOf("screenX=") == -1)
- strHelpOptions += ",screenX=" + gbWindowPosLeft; // Left position for help window (in pixels)(for netscape)
-
- if (strUsrWindowOption.indexOf("width=") == -1)
- strHelpOptions += ",width=" + gbWindowPosWidth; // Width of help window (in pixels)
-
- if (strUsrWindowOption.indexOf("outerWidth=") == -1)
- strHelpOptions += ",outerWidth=" + gbWindowPosWidth; // Width of help window (in pixels) (for netscape)
-
- if (strUsrWindowOption.indexOf("height=") == -1)
- strHelpOptions += ",height=" + gbWindowPosHeight; // Height of help window (in pixels)
-
- if (strUsrWindowOption.indexOf("outerHeight=") == -1)
- strHelpOptions += ",outerHeight=" + gbWindowPosHeight; // Height of help window (in pixels) (for netscape)
-
-
- if (strUsrWindowOption.length <= 0)
- strHelpOptions = strHelpOptions.substring(1); // remove the comma.
-
- if ((strUsrWindowOption.length > 0) && (strUsrWindowOption.lastIndexOf(",") == (strUsrWindowOption.length - 1)))
- strUsrWindowOption = strUsrWindowOption.substring(0, strUsrWindowOption.length - 1); // remove the comma.
-
-
- // if it is a remote url convert : to ?
- var npos1 = strUrl.indexOf("#RemoteURL=");
- if (npos1 != -1 ) {
- var npos2 = strUrl.indexOf("://", npos1);
- if (npos2 != -1 ) {
- strUrl = strUrl.substring(0, npos2) + "%072%057%057" + strUrl.substring(npos2+3);
- }
- }
- if (swh_IE) {
- strUrl = strUrl+","+ strUsrWindowOption + strHelpOptions;
- strHelpOptions = "left=2000,top=2000,height=1,width=1";
- window.open(strUrl, "HelpSecondary", strHelpOptions);
- }
- else {
- strHelpOptions = strUsrWindowOption + strHelpOptions;
- window.open(strUrl, "HelpStub", strHelpOptions);
- }
- }
-
- // Here is a tiny sample.
- //<HTML>
- //
- //<HEAD>
- // <TITLE>I need some help</TITLE>
- //
- // <SCRIPT LANGUAGE="JavaScript" src="showwebhelp.js">
- // </SCRIPT>
- //
- //</HEAD>
- //
- //<BODY>
- //<SCRIPT>
- // gbWindowPosLeft = 10;
- // gbWindowPosWidth = 700;
- //</SCRIPT>
- // How about a little <A HREF='javascript:ShowWebHelp("africa_csh.htm#TopicNumber=1,location=yes,left=30")'>Help (topicnumber)</A>
- // How about a little <A HREF='javascript:ShowWebHelp("africa_csh.htm#TopicId=TopicID1")'>Help (topicID)</A>
- // How about a little <A HREF='javascript:ShowWebHelp("africa_csh.htm#RemoteURL=http://www.ehelp.com")'>Help (RemoteURL)</A>
- //
- //</BODY>
- //
- //
- //</HTML>
- //
-